const express = require("express");
const interviewController = require("../controller/interviewController");
const requireAuth = require("../middleware/requireAuth");
const router = express.Router({ mergeParams: true });

router
  .route("/")
  .post(requireAuth, interviewController.createInterview)
  .get(requireAuth, interviewController.getAllInterview);

router
  .route("/:id")
  .delete(requireAuth, interviewController.deleteInterview)
  .patch(requireAuth, interviewController.updateInterview);

//走requireAuth中间件拿到user_id
router.route("/user").get(requireAuth, interviewController.getInterviewByUser);

//走requireAuth中间件拿到group
router
  .route("/group")
  .get(requireAuth, interviewController.getInterviewByGroup);

router
  .route("/groupspeed")
  .get(requireAuth, interviewController.getInterviewSpeedByGroup);

module.exports = router;
